<html>
<head>
<script src="../../main/resources/net/pimpas/web/jsf/components/js/pimpas/pimpas.js"></script>
<script>
// detect
pimpas.RequireJS( 'detect.js' );
// listener
pimpas.RequireJS( 'listener.js' );
// log
pimpas.RequireJS( 'log.js' );
// timer
pimpas.RequireJS( 'timer.js' );
// interval
pimpas.RequireJS( 'interval.js' );
// dom
pimpas.RequireJS( 'dom.js' );
// dom event
pimpas.RequireJS( 'event.js' );
// httprequest
pimpas.RequireJS( 'httpRequest.js' );
// ajax
pimpas.RequireJS( 'ajax.js' );
// ajaxpopulate
pimpas.RequireJS( 'ajaxPopulate.js' );
// input
pimpas.RequireJS( 'populate/input.js' );
// select
pimpas.RequireJS( 'populate/select.js' );
// select
pimpas.RequireJS( 'populate/radio.js' );
// checkbox
pimpas.RequireJS( 'populate/checkbox.js' );
// html
pimpas.RequireJS( 'populate/html.js' );
// xml
pimpas.RequireJS( 'xml.js' );
// xpath
pimpas.RequireJS( 'xpath.js' );
// json
pimpas.RequireJS( 'json.js' );
// control
pimpas.RequireJS( 'control/ajaxControl.js');
</script>
<script src="../../main/resources/net/pimpas/web/jsf/components/js/pimpas/soap.js"></script>
<style>
.classLoading {
	position: absolute;
	width: 100px;
	height: 20px;
	display: block;
	background-color: pink;
	left: 1180px;
	font-style:oblique;
}
</style>
</head>
<body>
<script>
var listener = new pimpas.HTTPRequest.Listener();
pimpas.Extends(listener, {
	alert: function() {
		
	},
	toString: function() {                                             
		return "my personal listener";
	},
	callBack: function(obj, evt, text, xml) {
		switch(evt) {
			case pimpas.HTTPRequest.events.onInitialize:
				pimpas.DOM.toVisible('loading');
				alert('init!');
			break;
			case pimpas.HTTPRequest.events.onError:
				alert('ERROR WHILE EXECUTING HTTPREQUEST => ' + text );
			break;
			
			case pimpas.HTTPRequest.events.onComplete:
				pimpas.DOM.toHidden('loading');
				alert('finished request!');
			break;
		}
	}
}
);

pimpas.HTTPRequest.addGlobalListener(listener);

function makeRequest() {
	var req = HTTPRequestPool.get( );
	req.setUrl('ServiceMe');
	HTTPRequestQueue.add(req);
}

HTTPRequestPool.init( 0 );
HTTPRequestPool.setPoolSize( 10 );
for(var i=0;i<10;i++)
	HTTPRequestPool.put(new pimpas.SOAPRequest( ));
</script>
<div id="loading" class="classLoading" style="display: none;">
	Loading ...
</div>
<input type="button" name="makeRequest" value="doRequest" onClick="makeRequest()">
</script>
</body>
</html>